{include file="header.html"}
<body>
<div class="body">
<ul class="nav nav-tabs">
 	<li><a href="{$appadmin}?m=koudai_product">产品管理</a></li>
    <li class="active"><a href="{$appadmin}?m=koudai_product&a=add">产品添加</a></li>
 </ul>
<div class="main-body ">
	 
    <style>
 	 
		.plist .item .num{width:30px; margin-right:10px; height:20px;}
		.plist .item .catid{width:60px; margin-right:10px; height:22px;}
    </style>
    <div class="plist">
    	{foreach item=c from=$kclist}
        <div class="item">
        	<div class="g-sd1">
            	<img src="{$c.imgurl|images_site}.100x100.jpg">
            </div>
            <div class="g-mn1">
            	<div class="g-mn1c">
                	<div class="title">{$c.title}</div>
                    <div class="row-price">
                    	<span>库存：{$c.total_num}</span> 
                        <span>销量：{$c.buy_num}</span> 
                        <span>￥{$c.price}元</span> 
                        
                        </div>
                     {if $c.koudai}   
                    <div class="row-price">
                    	<span>夜猫库存：{$c.ym_total_num}</span>
                        <span>夜猫销量：{$c.ym_buy_num}</span>
                    </div>
                    {/if}    
                    <div class="pro">
                    <select  class="catid">
                    	{foreach item=cc key=kk from=$catlist}
                        <option value="{$kk}" {if $kk eq $c.ym_catid} selected{/if}>{$cc}</option>
                        {/foreach}
                    	
                         
                    </select>
                    <input type="text" class="num" value="1">
                    <a href="javascript:;" productid="{$c.id}" class="btn  btn-small btn-success addProduct" url="{$appadmin}?m=koudai_product&a=addProduct&productid={$c.id}&ajax=1">添加</a></div>
                </div>
               
            </div>
             <div class="clearfix"></div>
        </div>
    	{/foreach}
    </div>

	 
</div>
<script>
$(function(){
	$(document).on("click",".addProduct",function(){
		var obj=$(this);
		$.get("{$appadmin}?m=koudai_product&a=addProduct&ajax=1&productid="+$(this).attr("productid")+"&total_num="+$(this).siblings(".num").val()+"&catid="+$(this).siblings(".catid").val(),function(data){
			skyToast(data.message);
		},"json");
		
	});
});
</script>  
</div>

</div> 
{include file='footer.html'}